package com.sxx.mall.product.web;

import com.sxx.mall.product.service.SkuInfoService;
import com.sxx.mall.product.vo.ItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**商品详情页控制器
 * @Auther: sunxx
 * @Date: 2024/8/12 - 08 - 12 - 0:21
 * @Description: com.sxx.mall.product.web
 * @version: 1.0
 */
@Controller
public class ItemController {
    @Autowired
    private SkuInfoService skuInfoService;
    @GetMapping("/{skuId}.html")
    public String item(@PathVariable Long skuId, Model model) throws ExecutionException, InterruptedException {

        ItemVO itemVO = skuInfoService.showItem(skuId);
        model.addAttribute("item",itemVO);
        return "item";
    }
}
